Add a conswitch command-line option to Xen.
transmitted/received character.
[NB. Default for this option is 'com1,tty']
+ conswitch=<switch-char><auto-switch-char>
+ Specify how to switch serial-console input between
+ Xen and DOM0. The required sequence is CTRL-<switch_char>
+ pressed three times. Specifying '`' disables switching.
+ The <auto-switch-char> specifies whether Xen should
+ auto-switch input to DOM0 when it boots -- if it is 'x'
+ then auto-switching is disabled. Any other value, or
+ omitting the character, enables auto-switching.
+ [NB. Default for this option is 'a']
+
dom0_mem=xxx Set the initial amount of memory for domain0.
pdb=xxx Enable the pervasive debugger. See docs/pdb.txt
transmitted/received character.
[NB. Default for this option is 'com1,tty']
+ conswitch=<switch-char><auto-switch-char>
+ Specify how to switch serial-console input between
+ Xen and DOM0. The required sequence is CTRL-<switch_char>
+ pressed three times. Specifying '`' disables switching.
+ The <auto-switch-char> specifies whether Xen should
+ auto-switch input to DOM0 when it boots -- if it is 'x'
+ then auto-switching is disabled. Any other value, or
+ omitting the character, enables auto-switching.
+ [NB. Default for this option is 'a']
+
dom0_mem=xxx Set the maximum amount of memory for domain0.
tbuf_size=xxx Set the size of the per-cpu trace buffers, in pages
/* opt_console: comma-separated list of console outputs. */
unsigned char opt_console[30] = "com1,vga";
+/* opt_conswitch: a character pair controlling console switching. */
+/* Char 1: CTRL+<char1> is used to switch console input between Xen and DOM0 */
+/* Char 2: If this character is 'x', then do not auto-switch to DOM0 when it */
+/* boots. Any other value, or omitting the char, enables auto-switch */
+unsigned char opt_conswitch[5] = "a"; /* NB. '`' would disable switching. */
/* opt_com[12]: Config serial port with a string <baud>,DPS,<io-base>,<irq>. */
unsigned char opt_com1[30] = "", opt_com2[30] = "";
/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */
void *var;
} opts[] = {
{ "console", OPT_STR, &opt_console },
+ { "conswitch", OPT_STR, &opt_conswitch },
{ "com1", OPT_STR, &opt_com1 },
{ "com2", OPT_STR, &opt_com2 },
{ "dom0_mem", OPT_UINT, &opt_dom0_mem },
#include <xen/keyhandler.h>
#include <asm/uaccess.h>
+extern unsigned char opt_console[], opt_conswitch[];
+
static int xpos, ypos;
static unsigned char *video = __va(0xB8000);
static char serial_rx_ring[SERIAL_RX_SIZE];
static unsigned int serial_rx_cons, serial_rx_prod;
-/* CTRL-a switches input direction between Xen and DOM0. */
-#define CTRL_A 0x01
+/* CTRL-<switch_char> switches input direction between Xen and DOM0. */
+#define SWITCH_CODE (opt_conswitch[0]-'a'+1)
static int xen_rx = 1; /* FALSE => serial input passed to domain 0. */
static void switch_serial_input(void)
{
static char *input_str[2] = { "DOM0", "Xen" };
xen_rx = !xen_rx;
- printk("*** Serial input -> %s "
- "(type 'CTRL-a' three times to switch input to %s).\n",
- input_str[xen_rx], input_str[!xen_rx]);
+ if ( SWITCH_CODE != 0 )
+ printk("*** Serial input -> %s "
+ "(type 'CTRL-%c' three times to switch input to %s).\n",
+ input_str[xen_rx], opt_conswitch[0], input_str[!xen_rx]);
}
static void __serial_rx(unsigned char c, struct pt_regs *regs)
static void serial_rx(unsigned char c, struct pt_regs *regs)
{
- static int ctrl_a_count = 0;
+ static int switch_code_count = 0;
- if ( c == CTRL_A )
+ if ( (SWITCH_CODE != 0) && (c == SWITCH_CODE) )
{
- /* We eat CTRL-a in groups of three to switch console input. */
- if ( ++ctrl_a_count == 3 )
+ /* We eat CTRL-<switch_char> in groups of 3 to switch console input. */
+ if ( ++switch_code_count == 3 )
{
switch_serial_input();
- ctrl_a_count = 0;
+ switch_code_count = 0;
}
}
else
{
- ctrl_a_count = 0;
+ switch_code_count = 0;
}
/* Finally process the just-received character. */
void init_console(void)
{
- extern unsigned char opt_console[];
unsigned char *p;
/* Where should console output go? */
{
if ( disable_vga )
vgacon_enabled = 0;
+
+ /*
+ * If user specifies so, we fool the switch routine to redirect input
+ * straight back to Xen. I use this convoluted method so we still print
+ * a useful 'how to switch' message.
+ */
+ if ( opt_conswitch[1] == 'x' )
+ xen_rx = !xen_rx;
+
/* Serial input is directed to DOM0 by default. */
switch_serial_input();
}